package com.yz.restructure.chapter2.afterrestructure;

/**
 * Created by Temp on 2017/9/13.
 */
public class Test1 {
    /**
     * 对参数的赋值
     * @param inputVal
     * @param quantity
     * @param yearToDate
     * @return
     */
    private int discount(int inputVal, int quantity, int yearToDate) {
        if (inputVal > 50) {
            inputVal -= 2;  //对参数赋值
        }

        if (quantity > 100) {
            inputVal -= 1;
        }

        if(yearToDate > 10000) {
            inputVal -= 4;
        }

        return inputVal;
    }

    /**
     * 去掉对参数的赋值
     * @param inputVal
     * @param quantity
     * @param yearToDate
     * @return
     */
    private int discount1(int inputVal, int quantity, int yearToDate) {
        int result = inputVal;

        if (inputVal > 50) {
            result -= 2;
        }

        if (quantity > 100) {
            result -= 1;
        }

        if(yearToDate > 10000) {
            result -= 4;
        }

        return result;
    }
}
